<?php
require_once 'DBConnector.php';
abstract class AbstractModel{
	protected $db;
	protected $targetTable;
	
	public function __construct(){
		$this->db=DBConnector::getDB();
	}
	
	/**
	 * 
	 * @param (string) $targetTable
	 * @return void
	 */
	
	public function setTargetTable($targetTable){
		$this->targetTable=$targetTable;
	}
	
	public function select($sth){
		$sth->execute();
		$sth->setFetchMode(PDO::FETCH_ASSOC);
		$arr = array();
		while($row=$sth->fetch()){
			$arr[]=$row;
		}
		return $arr;
	}
	
	public abstract function insert();
	public abstract function update();
	public abstract function delete($where);
}